from django.contrib import admin
from .models import Card, UserCard


@admin.register(Card)
class CardAdmin(admin.ModelAdmin):
    """卡牌管理"""
    list_display = ('name', 'attack_power', 'cost', 'rarity', 'is_active', 'created_at')
    list_filter = ('rarity', 'is_active', 'created_at')
    search_fields = ('name', 'description')
    ordering = ('-created_at',)


@admin.register(UserCard)
class UserCardAdmin(admin.ModelAdmin):
    """用户卡牌管理"""
    list_display = ('user', 'card', 'quantity', 'obtained_at')
    list_filter = ('obtained_at', 'card__rarity')
    search_fields = ('user__username', 'user__nickname', 'card__name')
    ordering = ('-obtained_at',)
